﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////


#pragma once

#include "GmUiInplaceEditCommon.h"
#include "GbmpGuid.h"

namespace gcmp
{
    class GM_UI_INPLACE_EDIT_COMMON_EXPORT SocketPortConfigRecord
    {
    public:
        SocketPortConfigRecord();
        SocketPortConfigRecord(const Guid& serverGuid, u_short port, const std::wstring& appName);

        std::wstring GetDebugString() const;
    public:
        Guid m_serverGuid;
        u_short m_port;
        std::wstring m_appName;
    };

    class GM_UI_INPLACE_EDIT_COMMON_EXPORT SocketPortConfig
    {
    public:
        static bool AddRecord(const SocketPortConfigRecord& record);
        static bool DeleteRecord(u_short port);

        static bool GetAllRecords(std::vector<SocketPortConfigRecord>& records);
        static bool GetAppRecords(const std::wstring& appName, std::vector<SocketPortConfigRecord>& records);

        static bool CreateJournalReplayEnvironment(const SocketPortConfigRecord& record);
    };
}
